<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/require/require-jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
	<h1>Hello RequireJS</h1>
	<input id="" type="button" value="测试1">
</body>
	<script type="text/javascript">
	// 简单的配置
	require.config({
	    // RequireJS 通过一个相对的路径 baseUrl来加载所有代码。baseUrl通常被设置成data-main属性指定脚本的同级目录。
	    baseUrl: "../js",//公共模块全局使用
	    paths: {
	        "math":"../js/require/demo/math",
	        "calc":"../js/require/demo/calc",
	        "dateUtil":"../js/require/demo/DateUtils",
	        "stringUtil":"../js/require/demo/StringUtils",
	        "jqFnUtil":"../js/require/demo/jqFnUtil"
	    },//定义自己的模块代码
	    //可以兼容合并一些非AMD书写规范的js文件
	    shim:{
			dateUtil:{
				  deps:[],
				  exports: "DateUtils"
			},
			stringUtil:{
				  deps:[],
				  exports: "StringUtils"
			},
			jqFnUtil:{
				  deps:[],
				  exports: "jqFnUtil"
			}
		}
	});
	// 开始使用jQuery 模块或者其他模块代码
	require(["jquery","calc","dateUtil","stringUtil","jqFnUtil","global"], function ($,calc,dateUtil,stringUtil,jqFnUtil,global) {
		var result=calc.call(3,5);
		var testArray=[1,2,5,12,3];
		alert(result);
		dateUtil.toString();
		stringUtil.toUpperCase();
		alert(jqFnUtil.jqDemo(testArray));
		global.speak("hahah");
	});
	
	</script>
</html>